import Fluent

struct CreateUser: Migration {
    
    func prepare(on database: Database) -> EventLoopFuture<Void> {
        database.schema("users")
            .id()
            .field("abbreviation", .string, .required)
            .field("firstName", .string, .required)
            .field("lastName", .string, .required)
            .field("machineUniqueIdentification", .string, .required)
            .field("email", .string, .required)
            .field("telephone", .string, .required)
            .field("nextcloudPassword", .string, .required)
            .field("isMale", .bool, .required)
            .field("isBlocked", .bool, .required)
            .field("isAllowedToChangeImages", .bool, .required)
            .field("isAllowedToChangeReferences", .bool)
            .field("isAllowedToSendMessage", .bool)
            .field("isAllowedToChangePDFs", .bool)
            .field("isAllowedToChangeVideos", .bool)
            .field("licenseExpire", .string)
            .create()
    }
    
    func revert(on database: Database) -> EventLoopFuture<Void> {
        database.schema("users").delete()
    }
}
